<%-- 
    Document   : user
    Created on : Apr 28, 2013, 7:11:47 PM
    Author     : wan.fairul
--%>
<%@ include file="/WEB-INF/jsp/include/page_header.jspf" %>
<%@ taglib prefix="display" uri="http://displaytag.sf.net"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.blockUI.js"></script> 
        <title>.: Change Password :.</title>    
        <script type="text/javascript">


            function validateFirst() {
                var validate = true;
                var message = "All field are required";
                if ($("#currPassword").val() === '')
                    validate = false;
                if ($("#newPassword").val() === '')
                {
                    validate = false;
                }
                else {
                    if ($("#newPassword").val().length < 6)
                    {
                        alert("New Passwords can not be less than 6 characters!");
                        return false;
                    }
                    else if ($("#newPassword").val().length > 20)
                    {
                        alert("New Passwords can not be more than 20 characters!");
                        return false;
                    }
                }
                if ($("#newPassword2").val() === '')
                {
                    validate = false;
                }
                else
                {
                    if ($("#newPassword").val() !== $("#newPassword2").val())
                    {
                        alert("New Password and Confirm New Password not same!!");
                        return false;
                    }
                }

                if (validate === false)
                    alert(message);
                if(validate === true)
                    return confirm("Click on OK to confirm");
                return validate;
            }


        </script>
    </head>
    <body>
        <s:messages/>
        <s:errors/>
        <s:form beanclass="exatrez.stripes.action.ChangePwdAction" name="form1">           
            <div>
                <fieldset>
                    <div id="page-title">
                        <span class="title">Change Password</span>
                    </div>
                    <p>
                        <label>User ID :</label>
                        ${actionBean.staff.userId}&nbsp;
                    </p>
                    <p>
                        <label>Current password :</label>
                        <s:password name="currPassword" style="width:250px" id="currPassword" class="clearAll" />
                    </p>
                    <p>
                        <label>New password :</label>
                        <s:password name="newPassword" style="width:250px" id="newPassword" class="clearAll"/>
                    </p>
                    <p>
                        <label>Confirm new password :</label>
                        <s:password name="newPassword2" style="width:250px" id="newPassword2" class="clearAll" />
                    </p>                    
                    <p>
                        <label>&nbsp;</label>
                        <s:submit name="savePassword" value="Submit" class="btn" onclick="return validateFirst()"/>
                        <s:button name="clear" value="Clear" class="btn clear"/>
                    </p>
                </fieldset>
            </div>            
        </s:form>

    </body>
</html>
